<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>day09_demo02</title>
<script>
	//1.直接定义事件
	function f1(){
		console.log(1);
		console.log(event);	
		
	}
	
	//2.动态绑定事件
	window.onload=function(){
		//给按钮2绑定事件
		var btn2=document.getElementById("btn2");
			btn2.onclick=function(){
				console.log(2);
				console.log(event);				
			};
	}
		


</script>


</head>
<body>
		
	<input type="button" value="按钮1" onclick="f1();"/>
	<input type="button" value="按钮2" id="btn2"/>



</body>
</html>